package com.yimils.core.goods.config;

import lombok.AllArgsConstructor;
import lombok.Getter;

public interface SupplierConstant {
    @Getter
    @AllArgsConstructor
    enum SupplierAuditState {
        WAIT("wait", "等待审核"),
        PASS("pass", "通过审核"),
        NOTPASS("notpass", "未通过审核");
        private String code;
        private String name;


        public static String getTypeName(String code) {
            for (SupplierAuditState supplierAuditState : SupplierAuditState.values()) {
                if (supplierAuditState.getCode().contains(code)) {
                    return supplierAuditState.getName();
                }
            }
            return null;
        }
    }

    @Getter
    @AllArgsConstructor
    enum SupplierIsAbleState {
        INABLE("inable", "可用"),
        DISABLE("disable", "不可用");
        private String code;
        private String name;


        public static String getTypeName(String code) {
            for (SupplierIsAbleState supplierIsAbleState : SupplierIsAbleState.values()) {
                if (supplierIsAbleState.getCode().contains(code)) {
                    return supplierIsAbleState.getName();
                }
            }
            return null;
        }

        public static String getTypeCode(String code) {
            for (SupplierIsAbleState supplierIsAbleState : SupplierIsAbleState.values()) {
                if (supplierIsAbleState.getCode().contains(code)) {
                    return supplierIsAbleState.getCode();
                }
            }
            return null;
        }
    }
}
